unit unitMain;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
  Buttons, unitEgoDepletion, unittodo;

type

  { TFrmMain }

  TFrmMain = class(TForm)
    BtnEgoDepletion: TBitBtn;
    BtnToDoLists: TBitBtn;
    BtnExit: TBitBtn;
    GroupBox1: TGroupBox;
    Panel1: TPanel;
    procedure BtnEgoDepletionClick(Sender: TObject);
    procedure BtnExitClick(Sender: TObject);
    procedure BtnToDoListsClick(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormCreate(Sender: TObject);
  private

  public

  end;

var
  FrmMain: TFrmMain;

implementation

{$R *.lfm}

{ TFrmMain }

procedure TFrmMain.FormCreate(Sender: TObject);
begin
  Self.Icon := TIcon.Create;
  Self.Icon.LoadFromResourceName(HInstance, 'ABSENTMINDED');
end;

procedure TFrmMain.BtnExitClick(Sender: TObject);
begin
  if(MessageDlg('您确定退出系统吗？', mtConfirmation, [mbNo, mbYes], 0)=mrYes) then Application.Terminate;
end;

procedure TFrmMain.BtnToDoListsClick(Sender: TObject);
var
  frm: TFrmTodo;
begin
  frm := TFrmTodo.Create(Self);
  frm.Show();
end;

procedure TFrmMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  if( MessageDlg('您确定退出系统吗？', mtConfirmation, [mbNo, mbYes], 0)=mrNo) then CanClose:=false;
end;

procedure TFrmMain.BtnEgoDepletionClick(Sender: TObject);
var
  frm: TFrmEgoDepletion;
begin
  frm := TFrmEgoDepletion.Create(Self);
  frm.Show();
end;

end.

